/**
,editoptions:{size:12,dataInit: function(element) {$(element).datepicker({dateFormat: 'yy-mm-dd'})}} 
,formoptions:{elmprefix:'(*)'}
, edittype:'select', editoptions:{value:{1:'One',2:'Two'}}
,editrules:{number:true}
**/

//一、本周工作动态(Operating Developments)
$(document).ready(function(){	
	$("#list_od").jqGrid({
		url: '/ajax/ajax_week_active.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_week_active.php?'+url_obj,
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ['序号(Item)', '井队名(Rig Name)',  '井名(Well Name)', '作业类别(Type)', '人工井底深度(PTD)', '套管深度(CTD)', '作业计划(Testing Program)', '下一井名(Next Well)', '备注(Remarks)'], //表头标题别名
		colModel: [			
			{name: 'active_id', index: 'active_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'team_name', index: 'team_name', width: 180, fixed:true, align: 'left',sortable:false, editable:false},
			{name: 'well_name', index: 'well_name', width: 180,fixed:true, align: 'left', sortable:false, editable:false},
			{name: 'work_type', index: 'work_type', width: 120, sortable:false, editable:false},
			{name: 'well_ptd', index: 'well_ptd', width: 120, sortable:false, editable:false},
			{name: 'ctd', index: 'ctd', width: 120, sortable:false, editable:false},
			{name: 'work_plan', index: 'work_plan', width: 180, sortable:false, editable:false},
			{name: 'next_well', index: 'next_well', width: 180, align: 'left', sortable:false, editable:false},
			{name: 'active_info', index: 'active_info', width: 180, align: 'left',search:false, sortable:false,editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_od'),
		//pgbuttons: true,
		rowNum: 5, //每页显示记录数
		rowList:[5, 10,20,30], //可调整每页显示的记录数
		sortname: 'active_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true //是否显示行数
	});
	
	$("#list_od").navGrid("#pager_od", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//二、本周生产作业情况 (Jobs Completeded in This Week): 作业记录（Jobs Records）
$(document).ready(function(){	
	$("#list_jcitw").jqGrid({
		url: '/ajax/ajax_zy_jobs_week.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_jobs_week.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ['序号(Item)',  '井名(Well Name)', '作业层位(Test No)', '开始日期(Start Date)', '结束日期(End Date)', '服务类别(Service)', '工程师(Engineer)', '作业状态(Status)','次数(Times)'], //表头标题别名
		colModel: [			
			{name: 'jobs_id', index: 'jobs_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'well_name', index: 'well_name', width: 180,fixed:true, align: 'left', sortable:false, editable:false},
			{name: 'test_no', index: 'test_no', width: 180, sortable:false, editable:false},
			{name: 'start_time', index: 'start_time', width: 140, sortable:false, editable:false},
			{name: 'end_time', index: 'end_time', width: 140, sortable:false, editable:false},
			{name: 'service_type', index: 'service_type', sortable:false, editable:false},
			{name: 'engineer', index: 'engineer', width: 100, sortable:false, editable:false},
			{name: 'states', index: 'states', width: 100,search:false, sortable:false,editable:false},
			{name: 'count', index: 'count', width: 100, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_jcitw'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'jobs_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_jcitw").navGrid("#pager_jcitw", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//二、本周生产作业情况 (Jobs Completeded in This Week):  设备使用记录 (Main Equipment in Use)
$(document).ready(function(){	
	$("#list_meiu").jqGrid({
		url: '/ajax/ajax_zy_equipment_use.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_equipment_use.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ['序号(Item)',  '设备名称(Equipment Name)', '出厂编号(Production No)', '井名(Well Name)', '作业层位(Test No)', '设备装态(Status)', '负责人(Charger)'], //表头标题别名
		colModel: [			
			{name: 'use_id', index: 'use_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'mc_name', index: 'mc_name', width: 180,fixed:true, align: 'left', sortable:false, editable:false},
			{name: 'comp_no', index: 'comp_no', width: 180, sortable:false, editable:false},
			{name: 'well_name', index: 'well_name', width: 120,fixed:true, align: 'left', sortable:false, editable:false},
			{name: 'test_no', index: 'test_no', width: 120, sortable:false, editable:false},
			{name: 'mc_state', index: 'mc_state', width: 120, sortable:false, editable:false},
			{name: 'charger', index: 'charger', width: 100,fixed:true, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_meiu'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'use_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_meiu").navGrid("#pager_meiu", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//三、本周主要工作(Main Jobs In This Week): zy_week_main_job
$(document).ready(function(){	
	$("#list_mjitw").jqGrid({
		url: '/ajax/ajax_zy_week_main_job.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_week_main_job.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ['序号(Item)',  '事件描述(Events)', '负责人(Charger)'], //表头标题别名
		colModel: [			
			{name: 'main_job_id', index: 'main_job_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'events', index: 'events', width: 550,fixed:true, align: 'left', sortable:false, editable:false},
			{name: 'charger', index: 'charger', width: 100,fixed:true, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_mjitw'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'main_job_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_mjitw").navGrid("#pager_mjitw", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//四、QHSE工作 (QHSE Jobs): 事故记录(Weekly QHSE Accident & Inccident Statistics)
$(document).ready(function(){	
	$("#list_wqa").jqGrid({
		url: '/ajax/ajax_zy_qhse.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_qhse.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)",  "事故（件）(Event)","类别(Type)","描述(Description)","措施(Current  Action)"], //表头标题别名
		colModel: [			
			{name: 'qhse_id', index: 'qhse_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'event', index: 'event', width: 120,fixed:true, align: 'left', sortable:false, editable:false},
			{name: 'type', index: 'type', width: 120, sortable:false, editable:false},
			{name: 'description', index: 'description', width: 250, sortable:false, editable:false},
			{name: 'current_action', index: 'current_action', sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_wqa'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'qhse_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_wqa").navGrid("#pager_wqa", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//四、QHSE工作 (QHSE Jobs): QSHE工作描述（Weekly QHSE Job Description）
$(document).ready(function(){	
	$("#list_wqjd").jqGrid({
		url: '/ajax/ajax_zy_qshe.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_qshe.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)",  "QSHE工作描述(QSHE Events)","负责人(Charger)"], //表头标题别名
		colModel: [			
			{name: 'qshe_id', index: 'qshe_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'qshe_info', index: 'qshe_info', fixed:true, align: 'left', width: 500, sortable:false, editable:false},
			{name: 'qshe_charger', index: 'qshe_charger', width: 120, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_wqjd'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'qshe_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_wqjd").navGrid("#pager_wqjd", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//五、人员和培训(Personnel and Training): zy_personnel_training
$(document).ready(function(){
	$("#list_pat").jqGrid({
		url: '/ajax/ajax_zy_personnel_training.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_personnel_training.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)",  "培训描述(Training Events)","负责人(Charger)"], //表头标题别名
		colModel: [			
			{name: 'train_id', index: 'train_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'event_info', index: 'event_info', fixed:true, align: 'left', width: 500, sortable:false, editable:false},
			{name: 'charger', index: 'charger', width: 120, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_pat'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'train_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_pat").navGrid("#pager_pat", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//六、市场信息（Marketing）: zy_marketing
$(document).ready(function(){
	$("#list_market").jqGrid({
		url: '/ajax/ajax_zy_marketing.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_marketing.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)",  "市场信息描述(Marketing Events)"], //表头标题别名
		colModel: [			
			{name: 'train_id', index: 'train_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'event_info', index: 'event_info', fixed:true, align: 'left', width: 600, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_market'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'train_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_market").navGrid("#pager_market", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//七、需协调的事宜(Things Need to Coordinate): zy_coordinate
$(document).ready(function(){
	$("#list_tntc").jqGrid({
		url: '/ajax/ajax_zy_coordinate.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_coordinate.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)",  "市场信息描述(Marketing Events)"], //表头标题别名
		colModel: [			
			{name: 'coordinate_id', index: 'coordinate_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'event_info', index: 'event_info', fixed:true, align: 'left', width: 600, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_tntc'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'coordinate_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_tntc").navGrid("#pager_tntc", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//八、下周主要工作(Main Jobs in Next Week)
$(document).ready(function(){
	$("#list_mjinw").jqGrid({
		url: '/ajax/ajax_zy_next_jobs.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_next_jobs.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)",  "市场信息描述(Marketing Events)"], //表头标题别名
		colModel: [			
			{name: 'jobs_id', index: 'jobs_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'event_info', index: 'event_info', fixed:true, align: 'left', width: 600, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_mjinw'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'jobs_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_mjinw").navGrid("#pager_mjinw", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});

//九、其它（Others)
$(document).ready(function(){
	$("#list_other").jqGrid({
		url: '/ajax/ajax_zy_other.php?'+url_obj, //显示的数据
		//editurl: '/ajax/ajax_zy_other.php',
		datatype: 'json', //xml、json、local(js直接赋值)
		mtype: 'POST',
		colNames: ["序号(Item)",  "市场信息描述(Marketing Events)"], //表头标题别名
		colModel: [			
			{name: 'train_id', index: 'train_id', width: 70,fixed:true,searchoptions:{sopt: ['eq']}},
			{name: 'event_info', index: 'event_info', fixed:true, align: 'left', width: 600, sortable:false, editable:false}
		],
		// JSON
		jsonReader: { 
			root: "list_data", 
			page: "page", 
			total: "total", 
			records: "records",
			repeatitems: false
		},		
		//width: 600,
		height:130,//整个显示的最大高度
		autowidth:true,
		shrinkToFit:false, //水平滚动条
		pager: $('#pager_other'),
		pginput: true,
		nowNum: 5,
		rowNum: 5,
		rowList:[5, 10,20,30],
		sortname: 'train_id',
		rownumbers: true, //自动行号
		//sortorder: "desc",
		viewrecords: true
	});
	
	$("#list_other").navGrid("#pager_other", {
			refresh: true,
			edit: false,
			add: false,
			del:false,
			search: false,
			position: "left"
		}
	);
});